Getting Started

MoltenObsidian can be used with two different methods :

As all tool-related operations are detailed on the tool's readme, this page focuses on getting started using the .NET library.

Installing the library

The MoltenObsidian library can be found on NuGet. Here's a rundown of the main packages you'll be using :

Package installation follows the same pattern as other NuGet packages. Use your IDE's package manager, or run these commands within the root of your .NET project :

# Base packages
dotnet package add "Nodsoft.MoltenObsidian" # For basic Obsidian Markdown conversions
dotnet package add "Nodsoft.MoltenObsidian.Blazor" # For Blazor Integration

# Vault providers
dotnet package add "Nodsoft.MoltenObsidian.Vaults.FileSystem" # For local vaults, imported from the filesystem
dotnet package add "Nodsoft.MoltenObsidian.Vaults.Http" # For remote vaults pulled over HTTP
dotnet package add "Nodsoft.MoltenObsidian.Vaults.Ftp" # For remote vaults located on FTP shares

Not all packages are necessary depending on your needs.

Converting raw Markdown

Converting an Obsidian-flavoured Markdown note to HTML is as simple as this :

using Nodsoft.MoltenObsidian;

// Create a new ObsidianText instance with the content to convert
ObsidianText obsidianMarkdown = new(@"
# Hello, world!   

This is a sample Markdown document.    
And a paragraph with **bold** and *italic* text.
");

// This is the HTML string you can then call in Blazor components as `@htmlText`.
MarkupString htmlText = obsidianMarkdown.ToHtml();

But that's just the basics. Under the hood, Markdig is what makes it happen. Easy!

Check out Markdown Conversion for more on converting raw markdown.

Setting up a vault

Now let's open an Obsidian vault on the Filesystem, and wire it to a routable Blazor component :

Startup.cs

using Nodsoft.MoltenObsidian.Blazor;
using Nodsoft.MoltenObsidian.Vault;
using Nodsoft.MoltenObsidian.Vaults.FileSystem;

// First deal with the DI, by adding a Filesystem vault and the Blazor integration:
public void ConfigureServices(IServiceCollection services)
{
	services.AddMoltenObsidianFileSystemVault(new DirectoryInfo("/path/to/vault"));
	services.AddMoltenObsidianBlazorIntegration();
}

_Imports.razor

@using Nodsoft.MoltenObsidian.Blazor
@using Nodsoft.MoltenObsidian.Blazor.Helpers;
@using Nodsoft.MoltenObsidian.Vault;

VaultPage.razor

@page "/vault/{*VaultPath}"  
@inject IVault Vault   
  
<ObsidianVaultDisplay BasePath="@this.GetCallingBaseVaultPath()" CurrentPath="@VaultPath" />  
  
@code {  
   [Parameter]  
   public string VaultPath { get; set; }
}

In a matter of minutes, you've just created a web app integration for your own Obsidian Vault, for all to see. Congratulations!